// 用户地址模块接口
import { request } from '@/api/index.js'

// 获取用户收货地址的请求
export const useGetUserAddressService = async () => {
  return request.get('/address/list')
}

// 获取 默认收货地址id 的接口请求
export const useGetDefAddressService = async () => {
  return await request.get('/address/defaultId')
}

// 获取省市区数据的接口请求
export const useGetAreaListService = async () => {
  return await request.get('/region/tree')
}

// 设置默认地址的请求
export const useSetDefAddressService = async (data) => {
  return await request.post('/address/setDefault', data)
}

// 获取收货地址详情的回调
export const useGetAddressDetailService = async (addressId) => {
  return request.get('/address/detail', { params: { addressId } })
}

// 增加收货地址的回调
export const useAddAddressService = async (data) => {
  return request.post('/address/add', data)
}

// 修改收货地址的回调
export const useUpdateAddressService = async (data) => {
  return request.post('/address/edit', data)
}

// 删除收货地址的回调
export const useDelAddressService = async (data) => {
  return request.post('/address/remove', data)
}
